#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue> 
//#define int unsigned long long
#define int long long
#define all(x) x.begin(), x.end()
using namespace std;

void solve()
{
	int n, k; cin >> n >> k;
	vector<int> arr(n); for (auto& e : arr) cin >> e;
	sort(all(arr));
	int cur = -1;
	auto it = lower_bound(all(arr), k) - arr.begin();
	vector<bool> jug(n + 1);
	int cnt = k;
	for (int i = 0; i < it; ++i)
	{
		if (jug[arr[i]] == false)
		{
			jug[arr[i]] = true;
			--cnt;
		}
		if (cnt == 0) break;
	}
	int ans = 0;
	for (int i = it; i < n; ++i) if (arr[i] == k) ans++, cnt--;
	else break;
	if (cnt > 0) ans += cnt;
	cout << ans << endl;
}

signed main()
{
	int t; cin >> t;
	while (t--) solve();
	return 0;
}

//0
//0 2 3
//0 1 2 3 4
//0 1 1 3 4 6
//0 1 2 2 2 3
//6 4
//3 3 3 3 3 3


//5 1 0 0 3 1 0 2 3 5 5 0 1 2 3 4 6 2 0 3 4 2 6 2 7 4 0 1 5 4 4 7 3
